package com.spider.demo;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class CrawlerDemo {

	public static void main(String[] args) throws Exception {

		//getText();
		String url = "http://www.wendaoxueyuan.com/post/detail/691";
		Document document = Jsoup.connect(url).get();
		Elements selects = document.select(".post-content img");

		for (Element element : selects) {
			System.out.println(element.attr("src"));
			
		}

	}

	public static void getText() throws IOException {
		String url = "http://www.wendaoxueyuan.com/post/detail/691";
		Document document = Jsoup.connect(url).get();
		Elements selects = document.select(".post-content p");

		for (Element element : selects) {
			System.out.println(element.text());
			
		}
	}

}
